The recent development in image processing technology and semiconductor technology has accelerated the automatization of the visual inspection tests of printed matters, and a number of testing systems based on the comparison of gradation image data have already been put into practical uses. The basic principle of the comparison method comprises the steps of registering an external picture image of a good product as a reference for comparison, obtaining a difference of each pixel of the picture image of the product to be tested from that of the reference image, and determining the acceptability of the product according to the magnitude of the differences.
It has also been proposed to compare consecutive the picture images of the products which are continually captured in time sequence.
According to these conventional methods, because the working principle is based on the evaluation of the differences between the two images in either case, it is essential to be free from any undue positional shifting between the picture patterns of the two images. If there any significant positional shifting, it results in amplified difference values, and the product is inevitably judged as defective. Thus, so-called pseudo defects would occur so frequently that a satisfactory testing procedure could not be carried out.
Therefore, previously, frequent occurrences of pseudo defects have been avoided by computing positional shifting between the two images with image processing means, and positional corrections have been conducted on the images according to the detected positional shifting between them before comparing the two images. A number of methods have been proposed according to the magnitude and nature of the particular positional shifting that is required to be corrected. If the positional shifting is limited to translation in x and y directions, the positional shifting .DELTA.x and .DELTA.y in x and y directions can be found by conducting a so-called template matching, using a representative region of a reference image, with respect to a neighborhood of the corresponding region of the test image. When the image involves extension/shrinkage and rotation as its positional shifting, the positional correction can be carried out by using a so-called geometric transformation process.
FIG. 5 is a conceptual diagram of a typical geometric transformation process used for positional correction according to the conventional method, and FIG. 6 is a flow chart of this process. An evaluation based on self differences is made with respect to a picture pattern of a reference image stored in reference image memory 102 obtained from an external appearance of a good product, and a desired number of regions (which are called as "cells" hereinafter) are selected as templates for computing positional shifting. The cells are selected from regions having large self differences such as regions including outlines.
In the example given in FIG. 5, six cells are selected. The image of the external appearance of the tested product is captured and stored in test image memory 103 as a test image. Once a full frame of the test image is entered in the test image memory 103, a template matching is carried out in a matching computation unit 104 with respect to each of the regions of the test image corresponding to the selected cells in the reference image, and the positional shifting (.DELTA.x.sub.e, .DELTA.y.sub.e) (e=1, 2, 3, 4, 5, 6) at each of the cell positions (cell regions) is computed. According to these six positional shift values, the coefficients of the equation of geometric transformation (affine transformation in this case) or the transformation parameters are determined in a transformation parameter generating unit 105. EQU x.sub.0i =T11x.sub.1i +T12y.sub.1i +T13 (1) EQU y.sub.0i =T21x.sub.1i +T22y.sub.1i +T23 (2)
where x.sub.0i : x-address of a pixel of the reference image
y.sub.0i : y-address of a pixel of the reference image PA1 x.sub.1i : x-address of a pixel of the test image corresponding to that of the reference image with respect to the picture pattern thereon PA1 y.sub.1i : y-address of the pixel of the test image corresponding to that of the reference image with respect to the picture pattern thereon PA1 T.sub.ij : transformation parameters
The generated equation of transformation is stored in an address transformation unit 106, and the pixel addresses (x.sub.1i, y.sub.1i) of the test image which correspond to the predetermined pixel addresses (x.sub.0i, y.sub.0i) of the reference image and have been subjected to positional correction are generated by this equation of transformation. Thus, during the test procedure, the pixels at the addresses (x.sub.1i, y.sub.1i) of the test image that are to be compared with those pixels at the corresponding addresses (x.sub.0i, y.sub.0i) of the reference image are supplied to a comparator 107, and the results of comparing the gradation values of the pixels on which positional shifting is corrected are produced so that the test image may be evaluated as either good or bad.
However, according to the conventional method, because the positional shifting is corrected with a geometrical process after the entire test image has been captured, and is based on the assumption that the extension/shrinkage and the translation of the picture pattern are uniform over the entire image, thus allowing a linear approximation to be applied to the two images to be compared, if there is any non-linear positional shifting or positional shifting involving localized extension/shrinkage, and the magnitude of extension/shrinkage varies from one place to another on the same image, the positional shifting cannot be totally eliminated even after a positional correction has been made, and the test of the external appearance based on such image processing may erroneously judge the product to be defective even when the product is quite normal. Also, because positional shifting is computed and positional correction is made after the entire image has been captured, memory for storing the entire image is required, and it means a high cost for the system, and a long processing time.